package Gui;
import java.awt.event.*;
import javax.swing.JButton;

public class ButtonClass {
	public static GameFrame GF = GameFrame.getInstance();
	public enum Buttons {
		ROLL, DEALCARDS, MAILCARDS, QUIT,STARTGAME,OPTIONS,INSTRUCTIONS,NOVALUE;
		public static Buttons toButtons(String str){
			try{
				return valueOf(str);
			}catch(Exception ex){
				return NOVALUE;				
			}
		}
	}
	//load button list for Game Screen
	public static void getGameButtons(){
		setButton("ROLL");
		setButton("DEALCARDS");
		setButton("MAILCARDS");
		setButton("QUIT");
	}
	//load button list of title screen
	public static void getMenuButtons(){
		setButton("STARTGAME");
		setButton("OPTIONS");
		setButton("INSTRUCTIONS");
	}

	public static void setButton(final String a_name) {
		JButton b = new JButton(a_name);
		b.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				switch (Buttons.toButtons(a_name)) {
				case QUIT:QuitAction();break;
				case ROLL:RollAction();break;
				case DEALCARDS:ViewDealCardsAction();break;
				case MAILCARDS:ViewMailCardsAction();break;		
				case STARTGAME:StartGameActions();break;
				case OPTIONS:OptionsActions();break;
				case INSTRUCTIONS:InstructionActions();break;
				default:break;
				}

			}
		});
		GF.add(b);//this adds the button to the frame
	}
	public static void StartGameActions() {
		System.out.println("Start Game Actions");
	}
	public static void OptionsActions() {
		System.out.println("Options Actions");
	}
	public static void InstructionActions() {
		System.out.println("Instructions Actions");
	}
	public static void RollAction() {
		System.out.println("Roll Actions");
	}

	public static void ViewDealCardsAction() {
		System.out.println("View Deal Cards Actions");
	}

	public static void ViewMailCardsAction() {
		System.out.println("View Mail Cards Actions");
	}

	public static void QuitAction() {
		System.out.println("Quit Actions");
	}
}
